<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<title>内部管理系统</title>
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">

<link rel="stylesheet" type="text/css"
	href="../../lib/bootstrap/css/bootstrap.css">
<link rel="stylesheet" type="text/css"
	href="../../stylesheets/theme.css">
<link rel="stylesheet"
	href="../../lib/font-awesome/css/font-awesome.css">

<script src="../../lib/jquery.min.js" type="text/javascript"></script>
<script src="../../lib/bootstrap/js/bootstrap.js"></script>
<script src="../../lib/jquery.validate.min.js"></script>
<script src="../../lib/jquery.cookie.js"></script>
<script src="../../lib/messages_cn.js" type="text/javascript"></script>
<script src="../../js/init.js"></script>
<link rel="stylesheet" href="//apps.bdimg.com/libs/jqueryui/1.10.4/css/jquery-ui.min.css">
<script src="//apps.bdimg.com/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="//apps.bdimg.com/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>

<style type="text/css">
#container {
	height: 300px;
	width: 400px;
}

.fl {
	float: left
}

select {
	width: 130px;
}
.title{
	font-size:18px;
	font-weight:bold;
}
</style>
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
      <script src="lib/html5.js"></script>
    <![endif]-->
</head>

<!--[if lt IE 7 ]> <body class="ie ie6"> <![endif]-->
<!--[if IE 7 ]> <body class="ie ie7 "> <![endif]-->
<!--[if IE 8 ]> <body class="ie ie8 "> <![endif]-->
<!--[if IE 9 ]> <body class="ie ie9 "> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!-->
<body class="">
	<!--<![endif]-->

	<div class="navbar"></div>
	<div class="common"></div>

	<div class="sidebar-nav"></div>

	<div class="content">
		<div class="well">
			<ul class="nav nav-tabs">
				<li class="active"><a href="#userlist" data-toggle="tab">企业</a></li>
			</ul>
			<div id="myTabContent" class="tab-content">
				<div class="tab-pane active in" id="storelist">

					<div class="container-fluid">
						<div class="span8">
							<form class="form-horizontal" id="user_form">
								<div class="control-group title">重置密码 </div>

								<div class="control-group">
									<label class="control-label">原密码：</label> 
									<input type="password"  id="oldpwd" name="oldpwd" placeholder="原密码">
									<div class="control-group">
									</div>
									<label class="control-label">新密码：</label> 
									<input type="password"  id="newpwd1" name="newpwd1" placeholder="新密码">
									<div class="control-group">
									</div>
									<label class="control-label">确认新密码：</label> 
									<input type="password"  id="newpwd2" name="newpwd2" placeholder="新密码">
									<label id="login-error" style="display:none;" class="alert-danger span8">用户名或密码错误</label>
								</div>
								<div class="form-actions">
									<button id="btn-save" type="button" class="btn ">重置</button>
								</div>

							</form>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>


	<script type="text/javascript">
	
		//初始化导航栏
		$(function() {
			initAdminNavBar();
			initCommon();
			initSideBar('user-management', 'pwd-list');
			$("#login-error").hide();
		});
		
		//保存
		$('#btn-save').on('click', function() {
			$("#login-error").hide();
			
			var oldpwd = $('#oldpwd').val();
			var newpwd1 = $('#newpwd1').val();
			var newpwd2 = $('#newpwd2').val();

			if (oldpwd != null && oldpwd != "" && newpwd1 != null && newpwd1 != "" && newpwd1 == newpwd2) {
				$.ajax({
					contentType : "application/json",
					url : api_base_url
						+ "resetPwd.json?oldPwd="
						+ oldpwd + "&newPwd="
						+ newpwd1,
						dataType : "json",
 						success : function(data) {
							if (data.code == "200") {
								window.location.href = "../system/homepage.html";
							}else{
								$("#login-error").text(data.msg);
	            				$("#login-error").show();
							}
						}
					});
				}else{
					$("#login-error").text("确认密码不一致");
   				 	$("#login-error").show();
				}
		});
	</script>

</body>
</html>


